/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Equivalents.impl;

import EA_Model.IEC61970.Domain.Conductance;
import EA_Model.IEC61970.Domain.Susceptance;

import EA_Model.IEC61970.Equivalents.EquivalentShunt;
import EA_Model.IEC61970.Equivalents.EquivalentsPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Equivalent Shunt</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Equivalents.impl.EquivalentShuntImpl#getB <em>B</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Equivalents.impl.EquivalentShuntImpl#getG <em>G</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class EquivalentShuntImpl extends EquivalentEquipmentImpl implements EquivalentShunt {
	/**
	 * The cached value of the '{@link #getB() <em>B</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getB()
	 * @generated
	 * @ordered
	 */
	protected Susceptance b;

	/**
	 * The cached value of the '{@link #getG() <em>G</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getG()
	 * @generated
	 * @ordered
	 */
	protected Conductance g;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EquivalentShuntImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return EquivalentsPackage.Literals.EQUIVALENT_SHUNT;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Susceptance getB() {
		if (b != null && b.eIsProxy()) {
			InternalEObject oldB = (InternalEObject)b;
			b = (Susceptance)eResolveProxy(oldB);
			if (b != oldB) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, EquivalentsPackage.EQUIVALENT_SHUNT__B, oldB, b));
			}
		}
		return b;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Susceptance basicGetB() {
		return b;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setB(Susceptance newB) {
		Susceptance oldB = b;
		b = newB;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, EquivalentsPackage.EQUIVALENT_SHUNT__B, oldB, b));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Conductance getG() {
		if (g != null && g.eIsProxy()) {
			InternalEObject oldG = (InternalEObject)g;
			g = (Conductance)eResolveProxy(oldG);
			if (g != oldG) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, EquivalentsPackage.EQUIVALENT_SHUNT__G, oldG, g));
			}
		}
		return g;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Conductance basicGetG() {
		return g;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setG(Conductance newG) {
		Conductance oldG = g;
		g = newG;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, EquivalentsPackage.EQUIVALENT_SHUNT__G, oldG, g));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case EquivalentsPackage.EQUIVALENT_SHUNT__B:
				if (resolve) return getB();
				return basicGetB();
			case EquivalentsPackage.EQUIVALENT_SHUNT__G:
				if (resolve) return getG();
				return basicGetG();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case EquivalentsPackage.EQUIVALENT_SHUNT__B:
				setB((Susceptance)newValue);
				return;
			case EquivalentsPackage.EQUIVALENT_SHUNT__G:
				setG((Conductance)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case EquivalentsPackage.EQUIVALENT_SHUNT__B:
				setB((Susceptance)null);
				return;
			case EquivalentsPackage.EQUIVALENT_SHUNT__G:
				setG((Conductance)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case EquivalentsPackage.EQUIVALENT_SHUNT__B:
				return b != null;
			case EquivalentsPackage.EQUIVALENT_SHUNT__G:
				return g != null;
		}
		return super.eIsSet(featureID);
	}

} //EquivalentShuntImpl
